// Piece.h
//
// Created By: Jeremy Butler
// Created On: 21-Mar-2011
//
// A generic chess piece

#ifndef PIECE_H
#define PIECE_H

#include "Location.h"

#include <set>
#include <iostream>
using namespace std;

enum Color { NO_COLOR, WHITE, BLACK };
enum PieceType { NO_TYPE, PAWN, ROOK, KNIGHT, BISHOP, KING, QUEEN };

class Board;

class Piece{
protected:
  PieceType type;
  Color color;
  //Location location;
  
public:
  //! @brief No-Arg Constructor
  Piece();

  //! @brief Constructor
  //! @param color the color to initialize this piece as.
  //! @param loc the location to initialize the piece to.
  Piece(const Color _color, const PieceType _type);
  
  //! @brief Copy Constructor
  //! @param other the Piece to be copied.
  Piece(const Piece & other);

  //! @brief get a copy of this 
  virtual Piece* Clone() const = 0;

  //! @brief Operator = to used to copy another Pawn to this one.
  //! @param other The Pawn to be copied to this one.
  //! @return a reference to the newly copied Pawn.
  Piece & operator = (const Piece & other);

  //! @brief Destructor
  virtual ~Piece();

  //! @brief Get a set of Valid Moves for this piece.
  //! @return a reference to a set of Locations to which this piece may move if it were
  //! 	at (row,col) on the board.
  virtual set<Location> GetValidMoves(const Board & board, int row, int col, bool allMoves = false) const = 0;

  //! @brief Get the Color of this piece.
  //! @return the Color of this Piece. (WHITE or BLACK)
  Color GetColor() const;

  //! @brief Get the Type of this Piece.
  //! @return the Type of this Piece.
  PieceType GetType() const;

  virtual string ToString() const = 0;

  //! @brief Get the Location of this Piece.
  //! @return a reference to the Location of this Piece.
  //const Location & GetLocation() const;

  static Color GetPieceColor(const string & color);

  static PieceType GetPieceType(const string & type);

  static string TypetoString(PieceType type);
  
};

#endif /* PIECE_H */
